package com.data.modules.feign;

import com.data.common.api.vo.CrmResult;
import com.data.common.crm.entity.AdminDeptVo;
import com.data.modules.ai.entity.AdminDeptBO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @Description
 * @Date 2022-2-22 10:43:47
 * @Author chj
 */
@Component
@FeignClient(name = "admin", url = "${crm.admin-url:}",contextId = "adminDept")
public interface AdminDeptService {

    /**
     * 查询主体层级
     *
     * @param pid
     * @return
     */
    @GetMapping("/adminDept/queryRpDeptTreeAll")
    CrmResult<Map<String,List<AdminDeptVo>>> queryRpDeptTreeAll(@RequestParam(value = "pid", required = false) Integer pid);

    /** 递归子集
     * @param bo
     * @return
     */
    @PostMapping("/adminDept/getChildDeptListByCompanyNames")
    CrmResult<Map<String, List<AdminDeptVo>>> getChildDeptListByCompanyNames(@RequestBody AdminDeptBO bo);


    /**
     * 根据主体名称获取主体子集集合
     *
     * @param deptNames
     * @return
     */
    @PostMapping("/adminDept/findDeptVoList/querySubjectByNames")
    CrmResult<Map<String,List<AdminDeptVo>>> querySubjectByNames(@RequestParam(value = "deptNames", required = false) String deptNames);


    /**
     * 根据公司名称查询公司信息集合
     *
     * @param deptNames
     * @return
     */
    @PostMapping("/adminDept/findDeptVoList/byDeptNames")
    CrmResult<List<AdminDeptVo>> byDeptNames(@RequestParam(value = "deptNames", required = false) String deptNames);


}
